'use strict';
var calculate_median = function(collection){
    let arr=[];
    for(let i in collection)
    {
        if(i%2!=0)
        {
            arr.push(collection[i]);
        }
    }
//console.log(arr);
if(arr.length%2===0)
{
    return (arr[arr.length/2-1]+arr[arr.length/2])/2;
}
else
{
    return arr[Math.floor(arr.length/2)];
}

};
module.exports = calculate_median;
